home *** CD-ROM | disk | FTP | other *** search
- #ifndef _LOG_H_
- #define _LOG_H_
- /*
- * $RCSfile: log.h,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:55:45 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
-
- /*
- * Maximum transactions that can be logged in a checkpoint record.
- * This maximum is designed to guarantee that stack space required
- * to generate a checkpoint record is < 3K since stack space is
- * limited to around 4K. The sanity of this value is checked in
- * checkPoint().
- */
- #define MAXTRANSCHKPNT 50
-
- /*
- * When a page is first dirtied, there are two ways to determine
- * the LRC of the first log record to update the page. For
- * debugging purposes incrementing the LRC on the page is
- * most appropriate since it guarantees that the LRC on a pages is
- * always an exact count of the number of operations performed on
- * a page. But, this requires additional LSN comparisons while
- * redoing records and requires patching LRC's on pages where
- * the server has a log record but the page was not shipped before
- * the transaction was aborted.
- *
- * To overcome these deficiencies the second way to determine the
- * first LRC to dirty a page is to use the current end-of-log LSN.
- * The server init's the lrc in a page with this lsn before
- * shipping it to the client. When a page is first allocated
- * its LRC is also set to the end-of-log.
- *
- * If the macro INIT_LRC_IS_LSN is defined then end-of-log LSNs
- * are used, otherwise the LRC is simply incremented and
- * patching is turned on.
- */
- #define INIT_LRC_IS_LSN
-
- /*
- * This routine generates a new lrc for a page.
- */
- #ifdef INIT_LRC_IS_LSN
- # define GENERATE_LRC(_lrc) \
- ( (_lrc)->wrapCount = OpenLog.wrapCount, \
- (_lrc)->count = OpenLog.tailLSN, \
- (_lrc))
- #else
- # define GENERATE_LRC(_lrc) INCREMENT_LRC((_lrc))
- #endif /* INIT_LRC_IS_LSN */
-
- /*
- * define a macro for setting the dependency lsn
- */
- #define DEPEND_LOG(_pageHash, _forceMark, _lsn, _lrc) \
- \
- if ((_pageHash)->lsn.offset == 0) { \
- \
- ((_pageHash)->lsn) = *(_lsn); \
- ((_pageHash)->lrc) = *(_lrc); \
- } \
- (_pageHash)->forceMark = _forceMark; \
- DIRTY_PAGE((_pageHash));
-
-
- /*
- * Define an error code that will signal a checkpoint
- */
- #define LOG_DO_CHECKPOINT 1
- #define LOG_EOF 2
-
-
- /*
- * define some log flags
- */
- #define LOG_RECOVERY 0x1
-
-
- /*
- * Macro to initialize the lrc on a newly allocated page
- */
- #ifdef INIT_LRC_IS_LSN
- # define INITIALIZE_LRC(_lrc) \
- ((_lrc)->wrapCount = OpenLog.wrapCount, \
- (_lrc)->count = OpenLog.tailLSN, (_lrc))
- #else
- # define INITIALIZE_LRC(_lrc) \
- ((_lrc)->wrapCount = 0, (_lrc)->count = 1, (_lrc))
- #endif /* INIT_LRC_IS_LSN */
-
- /*
- * Before a log record (log page) is placed in the log, there
- * must be some extra space still left in the log. This
- * extra space is the log slack.
- */
- #define LOG_SLACK (MAX_LOGREC_LEN * 2)
-
- #endif /* _LOG_H_ */
-